#include<bits/stdc++.h>
using namespace std;
int n,num1,num2;
string op[110],ad[110];
string s1[110],s2[110],ans[110];
int main()
{
	freopen("network.in","r",stdin);
	freopen("network.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>op[i]>>" ">>ad[i];
		if(op[i]=='Client')
		{
			int num3=i;
			for(int j=1;j<num3;j++)
			{
				if(ad[i]==ad[j]) ans[i]='OK',ans[j]='OK';
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(ans[i]=='OK') cout<<"OK"<<endl;
		else cout<<"FAIL"<<endl;
	}
	return 0;
}
